cmake_minimum_required(VERSION 3.8)

project(test_utils)


# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(lifecycle_msgs REQUIRED)
find_package(third_party REQUIRED)

# 添加头文件目录
include_directories(
  include
)

set(dependencies 
  rclcpp
  rclcpp_lifecycle
  lifecycle_msgs 
  third_party
)

# 创建库
add_library(${PROJECT_NAME} SHARED
  src/my_utils.cpp
  src/basic_lifecycle.cpp
)
ament_target_dependencies(${PROJECT_NAME} 
  rclcpp 
  rclcpp_lifecycle
  lifecycle_msgs
  std_msgs
)

install(DIRECTORY include/
  DESTINATION include
)

install(TARGETS ${PROJECT_NAME}
  ARCHIVE DESTINATION lib 
  LIBRARY DESTINATION lib 
  RUNTIME DESTINATION bin 
)

add_executable(test_plot 
  test/test_plot.cpp
)
ament_target_dependencies(test_plot rclcpp third_party)

install(
  TARGETS test_plot
  DESTINATION lib/${PROJECT_NAME}/
)


# 导出目标到ament
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_export_dependencies(${dependencies})

ament_package()